package com.lxb.myforum.pojo

import java.util.Date

import javax.persistence.Column
import javax.persistence.Entity
import javax.persistence.GeneratedValue
import javax.persistence.GenerationType
import javax.persistence.Id
import javax.persistence.Table
import javax.persistence.Temporal
import javax.persistence.TemporalType


import com.fasterxml.jackson.annotation.JsonFormat
import com.fasterxml.jackson.annotation.JsonProperty

@Entity
@Table(name = "t_dict")
data class Dictionary (
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    var id: Long? = null,
    var code: String? = null,
    var name: String? = null,

    @Column(name = "is_parent")
    @get:JsonProperty("isParent")
    @set:JsonProperty("isParent")
    var isParent: Boolean = false,

    @Column(name = "p_id")
    @get:JsonProperty("pId")
    var parentId: Long? = null,

    @Column(name = "dict_value")
    var dictValue: String? = null,

    @Column(name = "dict_key")
    var dictKey: String? = null,

    //	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_time")
    @get:JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    var createTime: Date? = null,

    //	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "update_time")
    @get:JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    var updateTime: Date? = null
){
    constructor(dictId: Long?) : this(id = dictId)

}